package impl;

import app.UserDef;
import cli.UserCli;
import comm.utill.Errno;
import comm.utill.Param;

public class UserImpl {

    public int addUserInfo(Param info) {
        UserCli cli = createCli();

        int rt = cli.addUserInfo(info);
        if (rt != Errno.OK) {
            System.out.println("addUserInfo err");
            return rt;
        }

        return rt;
    }

    private UserCli createCli() {
        UserCli cli = new UserCli();
        cli.init();
        return cli;
    }


    public static void main(String[] args){
        UserImpl userImpl = new UserImpl();

        Param info = new Param();
        info.setString(UserDef.Info.NAME, "三金");
        info.setInt(UserDef.Info.AGE, 25);
        userImpl.addUserInfo(info);
    }
}
